<?php

class m131107_033453_oak extends CDbMigration
{
    public function safeUp()
    {
        $sql = 'CREATE TABLE `{{friend}}`
                (
                    `id` int PRIMARY KEY AUTO_INCREMENT,
                    `user_id` bigint,
                    `friend_id` bigint,
                    `friend_name` varchar(255),
                    `friend_avatar` varchar(255),
                    `created_at` datetime,
                    `updated_at` datetime,

                    CONSTRAINT FOREIGN KEY (`user_id`) REFERENCES `{{user}}` (`id`)
                )
                ENGINE=InnoDB DEFAULT CHARSET=utf8;';

        $this->execute($sql);
    }

    public function safeDown()
    {
        return false;
    }
}